#ifndef QZIP_H
#define QZIP_H

#include "QZip_global.h"
#include <quazipfile.h>

#include <QDir>
#include <QMap>

namespace qzip
{
class QZip
{
public:

    enum QZ_Result
    {
        QZ_OK,
        QZ_BAD_INPUT_DIR,
        QZ_BAD_INPUT_LIST,
        QZ_BAD_OUTPUT,
        QZ_OUTPUT_EXISTS,
        QZ_UNEXPECTED_ERROR
    };


    static QZ_Result zipFolder(const QDir &dir, const QString &output);
    static QZ_Result zipFiles(const QStringList &files, const QString &output);

    static QStringList zippedFiles(const QString &zippedFile);

    static QZ_Result unzip(const QString &zippedFile, const QString &outdir, const QMap<QString, QString> &alternativeNames = QMap<QString, QString>(), bool stop=false);
    static QZ_Result unzipOnly(const QString &zippedFile, const QStringList &filterFiles, const QString &outdir, const QMap<QString, QString> &alternativeNames  = QMap<QString, QString>());

private:

    static QZ_Result doZip(QuaZip &zip, const QString &basePath, const QStringList &files, bool stop=false);
    static QZ_Result doUnzip(const QString &zippedFile, const QStringList &filterFiles, const QString &outdir, const QMap<QString, QString> &alternativeNames, bool stop=false);
};
}
#endif // QZIP_H
